package com.gitee.wsl.platform

//import kotlinx.io.SystemLineSeparator
import com.gitee.wsl.platform.network.NetworkChecker
import kotlinx.io.files.SystemPathSeparator


expect val platform:Platform

internal val defaultPlatform = object :Platform{
    override val current: PlatformType
        get() = PlatformType.OS.Unknown(Arch.UNKNOWN,  "Unknown")
}


 val Platform.Companion.pathSeparator: Char
    get() = SystemPathSeparator

/**
 * Return the application's total memory in bytes.
 *
 */
//expect fun Platform.maxMemory(): Long

 interface Platform {

     val lineSeparator: String
        get() = "/"

     val current:PlatformType

     val fileSeparator: String
        get() = "/"

    /**
     * Get the value of an environment variable.
     *
     * If the variable is not set, this function returns `null`.
     */
     fun readEnvironmentVariable(key: String): String?= null

     fun platformDisplay(chars: CharSequence){
        print(chars)
    }

     fun onShutdown(dispose: () -> Unit){}

     companion object:Platform {
         override val fileSeparator: String
             get() = platform.fileSeparator

          override val lineSeparator: String
              get() = platform.lineSeparator

          override val current: PlatformType
              get() = platform.current

          override fun readEnvironmentVariable(key: String): String?
                 = platform.readEnvironmentVariable(key)
      }
}



